import { request } from '@umijs/max';
import { IRes, IResPage } from '.';

export interface IBusinessClassification {
  id: number;
  nameLike: string;
  name: string;
}

export async function apiGetBusinessClassificationPage(
  params: Partial<IBusinessClassification>,
) {
  return request<IResPage<IBusinessClassification>>(
    '/obe/service/nav/list',
    {
      method: 'GET',
      params,
    },
  );
}

export async function apiGetBusinessClassificationList() {
  return request<IResPage<IBusinessClassification>>(
    '/v1/business/classification/list',
    {
      method: 'GET',
    },
  );
}

export async function apiGetBusinessClassificationSave(
  params: Partial<IBusinessClassification>,
) {
  return request<IRes<IBusinessClassification>>(
    '/obe/service/nav/newNav',
    {
      method: 'POST',
      data: params,
    },
  );
}

export async function apiGetBusinessClassificationUpdate(
  params: Partial<IBusinessClassification>,
) {
  return request<IRes<IBusinessClassification>>(
    '/obe/service/nav/updNav',
    {
      method: 'PUT',
      data: params,
    },
  );
}

export async function apiGetBusinessClassificationDelete(navId: number) {
  return request<IRes<boolean>>(`/obe/service/nav/delete/${navId}`, {
    method: 'DELETE',
  });
}
